<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<style>

    #bootstrap-table tr:nth-child(even) {
        background: transparent !important;
    }

    #bootstrap-table th {
        background: transparent !important;
    }

    #bootstrap-table a {
        width: 100%;
        height: 100%;
        display: block;
        color: #000000;
    }

    #bootstrap-table a:hover {
        color: #000000;
    }

    #bootstrap-table a:visited {
        color: #000000;
    }

    #bootstrap-table a:active {
        color: #000000;
    }
</style>
<body class="hold-transition skin-yellow sidebar-mini">
<section class="content-header">
    <h1>装配派工单查看</h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" class="form-horizontal">
                        <div class="row">
                            <div class="form-inline" style="padding-left: 15px">
                                <input th:value="${prodOrd.prodNo}" name="prodNo" style="display: none" type="hidden"/>
                            </div>
                        </div>
                    </form>
                </div>
                <div id="toolBar">
                    <div class="row">
                        <div class="form-inline">
                            <div class="form-group">
                                <label>项目编号：</label>
                                <label th:text="${prodOrd.prodNo}"></label>
                            </div>
                            <div class="form-group">
                                <label>项目名称：</label>
                                <label th:text="${project.proName}"></label>
                            </div>
                            <div class="form-group">
                                <label>数量：</label>
                                <label th:text="${prodOrd.prodNum}"></label>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    let table;
    $(function () {
        /**
         * 加载列表
         */
        table = js.table.init({
            url: ctx + "task/assemblySheetListView/list",
            showColumns: false,
            showExport: false,
            columns: [
                {
                    title: '序号', width: '60',
                    formatter: function (value, row, index, field) {
                        var pageSize = table.bootstrapTable('getOptions').pageSize;
                        var pageNumber = table.bootstrapTable('getOptions').pageNumber;
                        return pageSize * (pageNumber - 1) + index + 1;
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '类型', field: 'special', width: '70',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '部分', field: 'part',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },{
                    title: '装配体名称', field: 'drawName',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },{
                    title: '装配体图号', field: 'drawNo',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },{
                    title: '装配数量', field: 'drawNum',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },{
                    title: '要求完成时间', field: 'compTime',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '状态', field: 'status',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            if (value === 1) {
                                return '<span class="badge label-inverse">待提交</span>';
                            } else if (value === 2) {
                                return '<span class="badge label-success">已提交</span>';
                            }
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '创建人', field: 'createName',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '创建时间', field: 'createTime',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '提交日期', field: 'checkTime',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '操作', width: '60',
                    formatter: function (value, row, index) {
                        let elements = new Array();
                        elements.push('<button class="btn btn-info btn-xs" onclick="viewInfo('+row.id+')">查看</button>');
                        return elements.join('');
                    }, cellStyle: function (value, row, index) {
                        return {css: {"padding": "0", "background": "#FFFFFF"}}
                    }
                }
            ]
        });
        /**
         * 表格搜索
         */
        $("#btn-search").click(function () {
            js.table.search(table);
        });
    });

    /**
     * 重新加载
     */
    function reLoad() {
        js.table.refresh(table);
    }
    /**
     * 查看
     */
    function viewInfo(id) {
        window.open(ctx + 'assemble/assMake/makeView/' + id);
    }
</script>
</body>
</html>